# Contributor: Olliver Schinagl <oliver@schinagl.nl>
# Maintainer: Olliver Schinagl <oliver@schinagl.nl>
pkgname=shfmt
pkgver=3.1.2
pkgrel=0
pkgdesc="A shell parser, formatter, and interpreter (sh/bash/mksh)"
url="https://mvdan.cc/sh"
arch="all !mips !mips64"
license="BSD-3-Clause"
makedepends="go"
source="$pkgname-$pkgver.tar.gz::https://github.com/mvdan/sh/archive/v$pkgver.tar.gz"
builddir="$srcdir/sh-$pkgver"

build() {
	go build \
		-ldflags "-w -X main.version=$pkgver-$pkgrel" \
		-v \
		./cmd/shfmt
}

check() {
	go test ./...
}

package() {
	install -Dm755 shfmt "$pkgdir"/usr/bin/shfmt
}

sha512sums="6e367a7a05c5e18d6de7f822ef181443b22d05f94a5fe5a0cf4759bc1e4a07dfac0e2704eb3025868e0f44c0e04a9cbd28dfe5a977381b2ba6fe274ac97ef29a  shfmt-3.1.2.tar.gz"
